-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jul 17, 2021 at 11:46 PM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.3.27

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `real_estate_dbb`
--

-- --------------------------------------------------------

--
-- Table structure for table `addresses`
--

CREATE TABLE `addresses` (
  `property_id` int(10) NOT NULL,
  `city` varchar(40) NOT NULL,
  `suburb` varchar(40) NOT NULL,
  `street_name` varchar(40) NOT NULL,
  `street_number` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `addresses`
--

INSERT INTO `addresses` (`property_id`, `city`, `suburb`, `street_name`, `street_number`) VALUES
(1, 'Auckland', 'East Tamaki', 'Springs Road', 25),
(2, 'Auckland', 'East Tamaki', 'Great South Road', 6543),
(3, 'Auckland', 'East Tamaki', 'Henderson Rd', 643),
(4, 'Auckland', 'Manukau', 'Riverhuya Rd', 69),
(5, 'Auckland', 'Manukau', 'Pizdec Av', 41),
(6, 'Auckland', 'Manukau', 'Ebal Vrot Cr', 101),
(7, 'Auckland', 'Papatoetoe', 'Island Dr', 89),
(8, 'Auckland', 'Papatoetoe', 'Mudilo Loop', 228),
(9, 'Auckland', 'Papatoetoe', 'Salmon Av', 22),
(10, 'Hamilton', 'Te Rapa', 'Victory St', 78),
(11, 'Hamilton', 'Te Rapa', 'Moana Av', 55),
(12, 'Hamilton', 'Te Rapa', 'Dominion Rd', 4112),
(13, 'Hamilton', 'Te Rapa', 'Paker Av', 213),
(14, 'Hamilton', 'Te Rapa', 'Chettle Cr', 654),
(15, 'Wellington', 'CBD', 'Totara Av', 128),
(16, 'Wellington', 'CBD', 'Rosebank Rd', 18);

-- --------------------------------------------------------

--
-- Table structure for table `featuredlists`
--

CREATE TABLE `featuredlists` (
  `property_id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `photos`
--

CREATE TABLE `photos` (
  `id` int(10) NOT NULL,
  `property_id` int(10) NOT NULL,
  `photo_url` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `photos`
--

INSERT INTO `photos` (`id`, `property_id`, `photo_url`) VALUES
(1, 1, 'photos/60bee514407458.19159536.jpeg'),
(2, 2, 'photos/60bee5a680ba76.70176322.jpeg'),
(3, 3, 'photos/60bee5ad4ed603.22515273.jpeg'),
(4, 4, 'photos/60bee54e26c456.25291655.jpeg'),
(5, 5, 'photos/60bee55b180520.46388578.jpeg'),
(6, 6, 'photos/60bee57f51f908.95790583.jpeg'),
(7, 7, 'photos/60bee58e8b2e79.43703266.jpeg'),
(8, 8, 'photos/60bee59e4a41b0.37969092.jpeg'),
(9, 9, 'photos/60bee561ee1705.15726011.jpeg'),
(10, 10, 'photos/60bee569dd3b10.65987417.jpeg'),
(11, 11, 'photos/60bee5953bd855.06852678.jpeg'),
(12, 12, 'photos/60bee55531b009.72390534.jpeg'),
(13, 13, 'photos/60bee57199aec4.35130808.jpeg'),
(14, 14, 'photos/60bee58575bf01.63593349.jpeg'),
(15, 15, 'photos/60bee5782705c8.71996196.jpeg'),
(16, 16, 'photos/60bf00196e6eb4.17393710.jpeg');

-- --------------------------------------------------------

--
-- Table structure for table `properties`
--

CREATE TABLE `properties` (
  `id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  `bedrooms` int(10) NOT NULL,
  `price` int(10) NOT NULL,
  `description` varchar(1500) NOT NULL DEFAULT 'N/A',
  `date_listed` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `properties`
--

INSERT INTO `properties` (`id`, `user_id`, `bedrooms`, `price`, `description`, `date_listed`) VALUES
(1, 4, 2, 740000, 'No words describe what it feels like to live on top of', '2021-07-17 04:28:27'),
(2, 3, 5, 900300, 'Rarely does an opportunity come about in this area for such prime property', '2021-07-17 04:28:27'),
(3, 4, 4, 1750000, 'The epitome of contemporary waterfront sophistication luxury and style.', '2021-07-17 04:28:27'),
(4, 3, 6, 900000, 'Absolute best of the best, pedigree location - with ever-changing sea views across the ocean', '2021-07-17 04:28:27'),
(5, 2, 2, 1400000, 'As soon as you enter this refurbished 1970s stone waterfront home the views', '2021-07-17 04:28:27'),
(6, 3, 7, 6230000, 'The living is magnificent, open plan with solid oak floors, merging to luxurious carpets and the most expansive decks', '2021-07-17 04:28:27'),
(7, 4, 1, 690000, 'The gourmet kitchen is enormous with an island bench', '2021-07-17 04:28:27'),
(8, 2, 0, 200000, 'The outdoor living is simply without compromise, it takes entertaining to the next level', '2021-07-17 04:28:27'),
(9, 3, 2, 1475000, 'The elevation of the site means you have complete privacy', '2021-07-17 04:28:27'),
(10, 4, 5, 57500000, 'Everything you need for an incredible holiday home or permanent beachside residence', '2021-07-17 04:28:27'),
(11, 3, 3, 860000, 'Bay is fantastic for all water sports, fishing, or simply enjoy the ever-changing scene ', '2021-07-17 04:28:27'),
(12, 3, 2, 845000, 'If your dream is to own a slice of New Zealand waterfront paradise it doesnt get much better', '2021-07-17 04:28:27'),
(13, 4, 2, 1130000, 'If you have been looking for a home that truly does offer everything', '2021-07-17 04:28:27'),
(14, 4, 1, 789999, ' polished floors and entertainers kitchen, with fantastic views and incredible indoor', '2021-07-17 04:28:27'),
(15, 2, 6, 5650000, 'A fantastic set up for older children or extended family', '2021-07-17 04:28:27'),
(16, 4, 6, 2450000, 'The elevation of the site means you have complete privacy', '2021-07-17 04:28:27');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(10) NOT NULL,
  `login` varchar(20) NOT NULL,
  `type` varchar(10) NOT NULL DEFAULT 'customer',
  `pass` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `login`, `type`, `pass`) VALUES
(1, 'admin', 'admin', '$2y$10$c9TipNQw5vYP9vAyKtyaUOSq5yL4mkvKzZME7tKNBPe/30w8PJNCu'),
(2, 'Vacya', 'customer', '$2y$10$irPjoT0HN8AwFlCvCu48deHJzISC3XqZlloeVvxpCVjNz5e7Czdfu'),
(3, 'Sharik', 'customer', '$2y$10$fEnTGFgatpw/uaKz2x9J8OpLjqXRdp3Og7ng6iUt8tm4g15IpDvAa'),
(4, 'Oleg', 'customer', '$2y$10$c9TipNQw5vYP9vAyKtyaUOSq5yL4mkvKzZME7tKNBPe/30w8PJNCu'),
(33, 'asdf', 'customer', '$2y$10$I8oZiUfDRe8MtlbrGInMUuS8GEHML5s8zRwpk4xoYKDOZ2uQmAP9S');

-- --------------------------------------------------------

--
-- Table structure for table `wishlists`
--

CREATE TABLE `wishlists` (
  `property_id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  `state` int(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `addresses`
--
ALTER TABLE `addresses`
  ADD PRIMARY KEY (`property_id`);

--
-- Indexes for table `featuredlists`
--
ALTER TABLE `featuredlists`
  ADD PRIMARY KEY (`property_id`);

--
-- Indexes for table `photos`
--
ALTER TABLE `photos`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `photo_url` (`photo_url`),
  ADD KEY `property_id` (`property_id`);

--
-- Indexes for table `properties`
--
ALTER TABLE `properties`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `login` (`login`);

--
-- Indexes for table `wishlists`
--
ALTER TABLE `wishlists`
  ADD PRIMARY KEY (`property_id`,`user_id`),
  ADD KEY `user_id` (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `photos`
--
ALTER TABLE `photos`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `properties`
--
ALTER TABLE `properties`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=123;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `addresses`
--
ALTER TABLE `addresses`
  ADD CONSTRAINT `addresses_ibfk_1` FOREIGN KEY (`property_id`) REFERENCES `properties` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `featuredlists`
--
ALTER TABLE `featuredlists`
  ADD CONSTRAINT `featuredlists_ibfk_1` FOREIGN KEY (`property_id`) REFERENCES `properties` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `photos`
--
ALTER TABLE `photos`
  ADD CONSTRAINT `photos_ibfk_1` FOREIGN KEY (`property_id`) REFERENCES `properties` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `properties`
--
ALTER TABLE `properties`
  ADD CONSTRAINT `properties_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `wishlists`
--
ALTER TABLE `wishlists`
  ADD CONSTRAINT `wishlists_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `wishlists_ibfk_2` FOREIGN KEY (`property_id`) REFERENCES `properties` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
